<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>源达招聘</title>
      <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
</head>
<link rel="stylesheet" href="/static/wechat/css/weui.min.css">
<link rel="stylesheet" href="/static/wechat/css/space.css">
<script src="/static/wechat/js/zepto.min.js"></script>
<style>
    .hidden{
        
        display: none;
    }    
</style>
<body>
   <div class="bd_spacing">
       <div class="page_hd">
           <h1 class="page_title">源达投顾</h1>
        <div class="weui-cells__title">基本信息</div>
          <div class="weui-cells">
            <div  id="nameFlied" class="weui-cell">
                <div  class="weui-cell__hd"><label class="weui-label">姓名</label></div>
                <div class="weui-cell__bd">
                    <input id="nameInput" class="weui-input" type="text"  placeholder="请输入您的姓名"/>
                </div>
                 <div id="nameWarn" class="weui-cell__ft hidden">
                    <i class="weui-icon-warn"></i>
                </div>
            </div>
             <div id="genderFlied" class="weui-cell weui-cell_select">
                        <div class="weui-cell__hd">
                            <div class="weui_label" style="padding-left: 15px;">性别</div>
                        </div>
                        <div class="weui-cell__hd">
                            <select id="genderInput" class="weui-select">
                                <option selected="" value="1">男</option>
                                <option value="2">女</option>
                            </select>
                        </div>
                     <div id="genderWarn" class="weui-cell__ft hidden">
                        <i class="weui-icon-warn"></i>
                    </div>
              </div>    
            <div id="idNumberFlied" class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">身份证号</label>
                </div>
                <div class="weui-cell__bd">
                    <input id="idNumberInput" class="weui-input" type="text"  maxlength="18" placeholder="18位身份证号">
                </div>
                <div id="idNumberWarn" class="weui-cell__ft hidden">
                    <i class="weui-icon-warn"></i>
                </div>
            </div>
        <div id="jobFlied" class="weui-cell weui-cell_select">
                        <div class="weui-cell__hd">
                            <div class="weui_label" style="padding-left: 15px;">应聘职位</div>
                        </div>
                        <div class="weui-cell__hd">
                            <select id="jobInput" class="weui-select">
                                <option selected="" value="12">业务</option>
                                <option value="8">投资顾问</option>
                                <option value="11">营销策划</option>
                                <option value="4">财务</option>
                                <option value="10">市场</option>
                                <option value="1">人力资源</option>
                                <option value="2">行政</option>
                                <option value="3">律合规</option>
                                <option value="5">客户服务</option>
                                <option value="9">研发</option>
                                <option value="6">运维</option>
                                <option value="7">产品设计</option>
                            </select>
                        </div>
                      <div id="jobWarn" class="weui-cell__ft hidden">
                        <i class="weui-icon-warn"></i>
                    </div>
              </div> 
           </div>
<!--           教育信息-->
          <div class="weui-cells__title">教育信息</div>                  
          <div class="weui-cells">
            <div id="schoolFlied" class="weui-cell">               
                <div class="weui-cell__hd"><label class="weui-label">毕业学校</label>
                </div>
                <div class="weui-cell__bd">
                    <input id="schoolInput" class="weui-input" type="tel" placeholder="您的学校">
                </div>
                    <div id="schoolWarn" class="weui-cell__ft hidden">
                    <i class="weui-icon-warn"></i>
                </div>
            </div>   
            <div id="graduationTimeFlied" class="weui-cell">
                <div class="weui-cell__hd"><label for="" class="weui-label">毕业时间</label></div>
                <div class="weui-cell__bd">
                    <input id="graduationTimeInput" class="weui-input" type="date" value=""/>
                </div>
                   <div id="graduationTimeWarn" class="weui-cell__ft hidden">
                    <i class="weui-icon-warn"></i>
                </div>
            </div>
               <div id="educationFlied" class="weui-cell weui-cell_select">
                        <div class="weui-cell__hd">
                            <div class="weui_label" style="padding-left: 15px;">最高学历</div>
                        </div>
                        <div class="weui-cell__hd">
                            <select id="educationInput" class="weui-select">
<!--                                <option selected="" value="0">未选择</option>-->
                                <option selected="" value="1">大专</option>
                                <option value="2">本科</option>
                                <option value="3">硕士</option>
                                <option value="4">博士</option>
                            </select>
                        </div>
              </div> 
            <div id="majorFlied" class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">所学专业</label>
                </div>
                <div class="weui-cell__bd">
                    <input id="majorInput" class="weui-input" type="text"  maxlength="18" placeholder="您的专业">
                </div>
                    <div id="majorWarn" class="weui-cell__ft hidden">
                    <i class="weui-icon-warn"></i>
                </div>
            </div>  
         </div>
      <div class="weui-cells__title">联系方式</div>
              <div class="weui-cells">
            <div id="phoneFlied" class="weui-cell">   
                <div class="weui-cell__hd"><label class="weui-label">手机号</label></div>
                <div class="weui-cell__bd">
                    <input id="phoneInput"  maxlength="11" class="weui-input" type="text" placeholder="11位大陆手机号"/>
                </div>
                 <div id="phoneWarn" class="weui-cell__ft hidden">
                    <i class="weui-icon-warn"></i>
                </div>
            </div>
            <div id="wechatFlied" class="weui-cell">
                <div class="weui-cell__hd"><label class="weui-label">微信号</label>
                </div>
                <div class="weui-cell__bd">
                    <input id="wechatInput" class="weui-input" type="tel" placeholder="请输入微信号（选填）">
                </div>
                 <div id="wechatWarn" class="weui-cell__ft hidden">
                    <i class="weui-icon-warn"></i>
                </div>
            </div>
           </div>
        <br>
        <div class="button_sp_area">
           <button  href="javascript:;" class="weui-btn weui-btn_primary" onclick="submit();">提交</button>
    </div>
       
<!--
        <div class="weui-footer weui-footer_fixed-bottom">
            <p class="weui-footer__links">
                <a href="javascript:home();" class="weui-footer__link">源达投顾</a>
            </p>
            <p class="weui-footer__text">Copyright &copy; 1997-2016 </p>
        </div>
         
-->
          </div>
   </div>
<!--   手机号格式错误-->
     <div id="phoneNumberError" class="js_dialog" id="iosDialog2" style="display:none">
            <div class="weui-mask"></div>
            <div class="weui-dialog">
                <div class="weui-dialog__bd">手机号格式错误，仅支持大陆手机号哦。</div>
                <div class="weui-dialog__ft">
              <a href="#" class="weui-dialog__btn weui-dialog__btn_primary" id="phoneKnow" >知道了</a>
                </div>
            </div>
        </div>
<!--        身份证号格式错误  -->
     <div id="idNumberError" class="js_dialog" id="iosDialog2" style="display:none">
            <div class="weui-mask"></div>
            <div class="weui-dialog">
                <div class="weui-dialog__bd">身份证号格式错误。</div>
                <div class="weui-dialog__ft">
              <a href="#" class="weui-dialog__btn weui-dialog__btn_primary" id="idNumberKnow" >知道了</a>
                </div>
            </div>
        </div>
<!--   关注源达石晓薇-->
      <div id="shixiaoweiqrcode" class="js_dialog" id="iosDialog2" style="display:none">
            <div class="weui-mask"></div>
            <div class="weui-dialog">
                <div class="weui-dialog__bd">长按下面的二维码加源达石晓薇好友，随时获取源达资讯。<br><br>
                <img src="/static/wechat/img/shixiaoweiqrcode120.jpg" alt="">
                
                </div>
                <div class="weui-dialog__ft">
              <a href="/wechat/index/res_success" class="weui-dialog__btn weui-dialog__btn_primary" id="shixiaoweiknow" >知道了</a>
                </div>
            </div>
        </div>
    
    <script>
    
  function submit(){      
//    basic info  
      var userName =  $('#nameInput').val();
      var userGender =  $('#genderInput').val();
      var userIdNumber =  $('#idNumberInput').val();
      var userJob =  $('#jobInput').val();
//    education info
      var userSchool =  $('#schoolInput').val();
      var userGraduationTimeInput =  $('#graduationTimeInput').val();
      var userEducation =  $('#educationInput').val();
      var userMajor =  $('#majorInput').val();
//    link info
      var userPhone =  $('#phoneInput').val();
      var userWechat =  $('#wechatInput').val();
      
//      null check
      if(userName==""){
          $('#nameFlied').addClass('weui-cell_warn');
          $('#nameWarn').removeClass('hidden');
          return false;
      } 
      if(userGender==""){
          $('#genderFlied').addClass('weui-cell_warn');
          $('#genderWarn').removeClass('hidden');
          return false;
      } 
      if(userIdNumber==""){
          $('#idNumberFlied').addClass('weui-cell_warn');
          $('#idNumberWarn').removeClass('hidden');
          return false;
      } 
      if(userJob==""){
          $('#jobFlied').addClass('weui-cell_warn');
          $('#jobWarn').removeClass('hidden');
          return false;
      } 
      if(userJob==""){
          $('#jobFlied').addClass('weui-cell_warn');
          $('#jobWarn').removeClass('hidden');
          return false;
      } 
      if(userSchool==""){
          $('#schoolFlied').addClass('weui-cell_warn');
          $('#schoolWarn').removeClass('hidden');
          return false;
      } 
      if(userGraduationTimeInput==""){
          $('#graduationTimeInput').addClass('weui-cell_warn');
          $('#graduationTimeInput').removeClass('hidden');
          return false;
      } 
      if(userEducation==""){
          $('#educationFlied').addClass('weui-cell_warn');
          $('#educationWarn').removeClass('hidden');
          return false;
      } 
      if(userMajor==""){
          $('#majorFlied').addClass('weui-cell_warn');
          $('#majorWarn').removeClass('hidden');
          return false;
      }
       if(userPhone==""){
          $('#phoneFlied').addClass('weui-cell_warn');
          $('#phoneWarn').removeClass('hidden');
             return false;
      } 
  
      
//    reg phone check
      
       if(!(/^1[34578]\d{9}$/.test(userPhone))){   
                  $("#phoneNumberError").css('display','block');
        return false; 
        } 
      // reg idcard check
     
      var res = isCardNo(userIdNumber);

          if(res == '0'){
            $("#idNumberError").css('display','block');
              return false;
          }
//  to post
      $.post("/wechat/Index/addLinkMan/",{userName:userName,userGender:userGender,userIdNumber:userIdNumber,userJob:userJob,userSchool:userSchool,userGraduationTime:userGraduationTimeInput,userEducation:userEducation,userMajor:userMajor,userPhone:userPhone,userWechat:userWechat},
                      function(data){
          
//          alert(data);
          if(data=='1'){
              
                 $("#shixiaoweiqrcode").css('display','block');
          }else{
              
              alert('发生错误将刷新本页后重试');
              window.location.reload();
          }
          
  
                     });

       
  }        
        //身份证号验证
    function isCardNo(idNumber){  
   // 身份证号码为15位或者18位，15位时全为数字，18位前17位为数字，最后一位是校验位，可能为数字或字符X  
       var reg = /(^\d{15}$)|(^\d{18}$)|(^\d{17}(\d|X|x)$)/;  
       if(reg.test(idNumber) === false)  
       {  
            //error
           return  '0';  
       }else{
           //fine
           return  '1';

       }  
    }  
      
    </script>
    <script>
    $('#phoneKnow').bind('click', function() {  
      $("#phoneNumberError").css('display','none');
                })
    </script>
    <script>
        $('#idNumberKnow').bind('click', function() {  
      $("#idNumberError").css('display','none');
                })
    
    </script>
       <script>
        $('#shixiaoweiknow').bind('click', function() {  
      $("#iosDialog2").css('display','none');
                })
    
    </script>
     
</body>
</html>